package com.magicborrow.utils;

import android.graphics.ColorMatrixColorFilter;
import android.view.MotionEvent;
import android.view.View;

import com.magicborrow.R;

/**
 * Created by ghost on 16/5/9.
 */
public class ViewPressedUtil {


    public static final View.OnTouchListener TouchPress = new View.OnTouchListener() {

  /*      public final float[] BT_SELECTED = new float[]{
                1, 0, 0, 0, -50,
                0, 1, 0, 0, -50,
                0, 0, 1, 0, -50,
                0, 0, 0, 1, 0};
        public final float[] BT_NOT_SELECTED = new float[]{
                1, 0, 0, 0, 0,
                0, 1, 0, 0, 0,
                0, 0, 1, 0, 0,
                0, 0, 0, 1, 0};
        private boolean isNull;*/

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            /*if(v.getBackground()==null||v.getBackground()==android.R.color.transparent)*/


            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                /*v.getBackground().setColorFilter(
                        new ColorMatrixColorFilter(BT_SELECTED));
                v.setBackgroundDrawable(v.getBackground());*/
                v.setAlpha(0.7f);
            } else if (event.getAction() == MotionEvent.ACTION_UP) {
                /*v.getBackground().setColorFilter(
                        new ColorMatrixColorFilter(BT_NOT_SELECTED));
                v.setBackgroundDrawable(v.getBackground());*/
                v.setAlpha(1);
            }
            return false;
        }
    };
}
